package com.etc.sfts.biz.ipml;

import java.util.List;

import com.etc.sfts.biz.OrderBiz;

import com.etc.sfts.dao.OrderDao;
import com.etc.sfts.entity.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderBizImpl implements OrderBiz{
@Autowired
private OrderDao dao ;

	@Override
	public boolean addOrder(Order order) {
		if(order!=null) {
			return dao.insertOrder(order);
		}
		return false;
	}

	@Override
	public boolean deleteOrderById(Integer id) {
		if(id!=null&&id>0) {
			return dao.deleteOrderById(id);
		}
		return false;
	}

	@Override
	public boolean updateOrderById(Integer id, String status) {
		if(id!=null&&status!=null) {
			return dao.updateOrderById(id, status);
		}
		return false;
	}

	@Override
	public List<Order> getOrderByPhone(String phone) {
		if(phone!=null) {
			return dao.queryOrderByPhone(phone);
		}
		return null;
	}

	@Override
	public Order getOrderById(Integer id) {
		if(id!=null&&id>0) {
			return dao.queryOrderById(id);
		}
		return null;
	}

	@Override
	public Long getOrderCount() {
		// TODO Auto-generated method stub
		return dao.queryOrder();
	}

}
